You are here: Statements and Functions > Prompt
Syntax samples
PROMPT <string expression>, <name>{, <choice1>:<expression1>,
<choice2>:<expression2>, <choice3:<expression3>...}
PROMPT "Enter the number of entities to process:", Var2
PROMPT "Enter the size of batches to accumulate:",Var1, "Large": 20, "Medium": 15, "Small": 10
Pauses the simulation and displays either a message and input field or a menu for selecting a choice. The value entered or selected is then assigned to the designated variable, array element, or attribute. To have PROMPT present a menu, specify one or more choices as in the second syntax example above. The value already in the variable, array element, or attribute is used as the default value in the dialog box. One use of PROMPT is to give the user the option to change the operation time represented by a variable during a simulation.
Any logic.
Components
<string expression>
The message to display. This expression should tell the user what value to enter or choose.
<name>
The name of the variable, array element, or attribute to give the value. The value already in this item will be used as the default value.
<choices>
A string expression identifying the choice. Any number of choices may be specified, and all must have corresponding expressions.
<expressions>
The value to assign the variable, array element or attribute if the user selects the corresponding choice from the menu.
Example
The logic below uses PROMPT to let the user select any size of a batch. Attr1 represents the batch size for EntA. If the batch size has not been set (if Attr1=0), then the user is prompted to enter the batch size. The SPLIT AS statement then splits the single entity into the number of entities specified in the prompt dialog box. The PROMPT statement in this example displays the following dialog box.
IF Attr1=0 THEN
PROMPT "Enter the Batch Size", Attr1
SPLIT Attr1 AS EntA
Example
This logic works similarly to the logic in example one, except that it uses PROMPT to let the user select from one of three different sized batches. The PROMPT statement in this example displays the dialog box below.
IF Attr1=0 THEN
PROMPT "Enter the Batch Size", Attr1, "Small":10, "Medium":15, "Large":20
SPLIT Attr1 AS EntA
PAUSE; DISPLAY. Also see Run-Time Interface.